package uml;

import com.sun.tools.corba.se.idl.InterfaceState;

import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author sunqiyuan
 * @Classname sad
 * @Description TODO
 * @Date 2020-07-23 10:37
 * @Version V1.0
 */
public interface interfaceStard {

    int flags = 0;
    public void hello();

    abstract class AbstractBase implements interfaceStard {
        /**
         * {@inheritDoc}
         */
        @Override
        public void hello() {


        }
    }

    /**
     * donothing
     */
    public static class NoOp extends AbstractBase {
        @Override
        public void hello() {
            super.hello();
        }
    }

    public static class ForSpecial extends AbstractBase {
        @Override
        public void hello() {
            super.hello();
        }
    }

    public static class Compound extends AbstractBase{
        // map Map<String, interfaceStard> interfaceStardMap =new HashMap<>();
        List<interfaceStard>  interfaceStardList = new ArrayList<>();

        public void add(interfaceStard single){
            interfaceStardList.add(single);
        }

        @Override
        public void hello() {
            if(interfaceStardList.isEmpty()){
                // todo default
            }else{
                for (interfaceStard e: interfaceStardList) {
                    e.hello();
                    // todo special
                }
            }
        }
    }

    enum NoOp_1 implements interfaceStard {

        /**
         * The singleton instance.
         */
        INTANCE;

        @Override
        public void hello() {

            URL abClassPath = getClass().getClassLoader().getResource(getClass().getName().replace(".","/")+ ".class");
            System.out.println(abClassPath);

        }
    }

    public static void main(String[] args) {
        NoOp_1.INTANCE.hello();

    }
}
